/**
 * Copyright 2011, Under-Ground Studio.
 *  
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *  
 *      http://www.apache.org/licenses/LICENSE-2.0
 *  
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cn.edu.zju.vlis.aus.chart;

/**
 * Interface for chart to retrieve data.
 * 
 * @author ymsong (songyuming1985@gmail.com) 2011-8-4
 */
public interface ChartDataAdapter {

	/**
	 * Return the item count number.
	 * 
	 * @return item count number
	 */
	int getItemCount();

	/**
	 * Return the chart data item at specified index.
	 * 
	 * @param index
	 * @return the chart data.
	 */
	ChartDataItem getItem(int index);

	/**
	 * Return the chart data item with specified id.
	 * 
	 * @param id
	 *            the id of the data.
	 * @return the chart data.
	 */
	ChartDataItem getItem(String id);

	/**
	 * Add an listener that will be called when changes happen to the data used
	 * by this adapter.
	 * 
	 * @param listener
	 *            the listener that gets notified when the data set changes.
	 */
	void addListener(ChartDataAdapterListener listener);

	/**
	 * Remove an listener that has previously been add with this adapter via
	 * {@link #addListener(ChartDataAdapterListener)}.
	 * 
	 * @param listener
	 *            the listener to remove.
	 * 
	 */
	void removeListener(ChartDataAdapterListener listener);
}
